package com.tonyodev.fetch2;

import ohos.app.Context;
import ohos.event.commonevent.CommonEventSubscriber;
import ohos.event.intentagent.IntentAgent;
import ohos.event.notification.NotificationRequest;

import java.util.List;

/**
 * FetchNotificationManager
 *
 * @since 2021-05-20
 */
public interface FetchNotificationManager {
    /**
     * getNotificationManagerAction
     *
     * @return String
     */
    String getNotificationManagerAction();

    /**
     * getBroadcastReceiver
     *
     * @return CommonEventSubscriber
     */
    CommonEventSubscriber getBroadcastReceiver();

    /**
     * updateGroupSummaryNotification
     *
     * @param groupId groupId
     * @param notificationBuilder notificationBuilder
     * @param downloadNotifications downloadNotifications
     * @param context context
     * @return updateGroupSummaryNotification
     */
    boolean updateGroupSummaryNotification(int groupId, NotificationRequest notificationBuilder, List<DownloadNotification> downloadNotifications, Context context);

    /**
     * updateNotification
     *
     * @param notificationBuilder notificationBuilder
     * @param downloadNotification downloadNotification
     * @param context context
     */
    void updateNotification(NotificationRequest notificationBuilder, DownloadNotification downloadNotification, Context context);

    /**
     * notify
     *
     * @param groupId groupId
     */
    void notify(int groupId);

    /**
     * getGroupActionPendingIntent
     *
     * @param groupId groupId
     * @param downloadNotifications downloadNotifications
     * @param actionType actionType
     * @return IntentAgent
     */
    IntentAgent getGroupActionPendingIntent(int groupId, List<DownloadNotification> downloadNotifications, DownloadNotification.ActionType actionType);

    /**
     * getActionPendingIntent
     *
     * @param downloadNotification downloadNotification
     * @param actionType actionType
     * @return IntentAgent
     */
    IntentAgent getActionPendingIntent(DownloadNotification downloadNotification, DownloadNotification.ActionType actionType);

    /**
     * cancelOngoingNotifications
     */
    void cancelOngoingNotifications();

    /**
     * cancelNotification
     *
     * @param notificationId notificationId
     */
    void cancelNotification(int notificationId);

    /**
     * createNotificationChannels
     *
     * @param context context
     */
    void createNotificationChannels(Context context);

    /**
     * getChannelId
     *
     * @param notificationId notificationId
     * @param context context
     * @return ChannelId
     */
    String getChannelId(int notificationId, Context context);

    /**
     * postDownloadUpdate
     *
     * @param download mDownload
     * @return is postDownloadUpdate
     */
    boolean postDownloadUpdate(Download download);

    /**
     * getNotificationBuilder
     *
     * @param var1 var1
     * @param var2 var2
     * @return NotificationRequest
     */
    NotificationRequest getNotificationBuilder(int var1, int var2);

    /**
     * shouldUpdateNotification
     *
     * @param downloadNotification mDownloadNotification
     * @return is shouldUpdateNotification
     */
    boolean shouldUpdateNotification(DownloadNotification downloadNotification);

    /**
     * shouldCancelNotification
     *
     * @param downloadNotification mDownloadNotification
     * @return is shouldCancelNotification
     */
    boolean shouldCancelNotification(DownloadNotification downloadNotification);

    /**
     * registerBroadcastReceiver
     */
    void registerBroadcastReceiver();

    /**
     * unregisterBroadcastReceiver
     */
    void unregisterBroadcastReceiver();

    /**
     * getFetchInstanceForNamespace
     *
     * @param fetch mFetch
     * @return Fetch
     */
    Fetch getFetchInstanceForNamespace(String fetch);

    /**
     * getNotificationTimeOutMillis
     *
     * @return TimeOutMillis
     */
    long getNotificationTimeOutMillis();

    /**
     * getDownloadNotificationTitle
     *
     * @param download download
     * @return getNotificationTitle
     */
    String getDownloadNotificationTitle(Download download);

    /**
     * getSubtitleText
     *
     * @param context context
     * @param downloadNotification
     * @return SubtitleText
     */
    String getSubtitleText(Context context, DownloadNotification downloadNotification);
}
